package seu.evaluation.metric;


/**
 * 
 * @author samantha
 * Tight Class Cohesion（紧密内聚性）：直接关联密度
 *
 */
public class CohesionTCC extends MaintainabilityMetricStrategy{
	
	public CohesionTCC(){}

	@Override
	protected String getType() {	
		return "CohesionTCC";
	}

	@Override
	protected double differentMetricMethod(MaintainabilityEntity entity) {
		if(entity.getS()<=1)
			return -1;
		else{
			/*
			double temp1=(double)entity.getE()+entity.getX()+entity.getW()+entity.getR() ;
			double temp2= (double)entity.getS() * ( entity.getS()-1 ) / 2 ;
			*/
			double temp1 = (double)entity.getInterEdge();
			double temp2 = (double)entity.getS() * ( entity.getS()-1 ) / 2 ;
			return temp1/temp2;
		}
	}

	@Override
	protected void preprocess() {}
}
